<template>
	<view>
		  <view class=""v-for="(j,index) in arr" :key="index">
		 	<uni-section title="卡片标题+额外信息" type="line">
		 				<uni-card title="" extra="" >
							<image :src="j.commodityimg[0].pash" style="width: 155rpx;height: 155rpx; float: left;" mode=""></image>
							<view class="">
								<view class="" style="float:left ;">
									<text  style="float:left ;"> {{j.commodity.commodityName}}</text>
								</view>
								<view class="" style="float: right;" @click="sc(j.footprintId)">
									删除
								</view>
							</view>
							<view class="" style="margin-top: 80rpx;">
								   <text style="color: #FF0000;" ><h3>{{j.commodity.price}}币</h3></text>
							</view>
		 					  
		 				</uni-card>
		 			</uni-section>
		 </view>
	</view>
</template>

<script>
	import request from '../../request.js'
	export default {
		data() {
			return {
				userId:'',
				arr:{},
				footprintId:'',
			}
		},
		onLoad(w){
			uni.getStorage({
								key: 'userid',
								success: res => {
									this.userid = res.data
									console.log("zaizhe", this.userid)
									this.userId=this.userid	
								}
							})
			this.load();
							
		},
		methods: {
			load(){
				request({
					url:'xkuser/user/loadfoot/'+this.userId,
					method:'get',
					success:(res)=>{
						this.arr=res.data.data.arr
						console.log(this.arr)
					}
					
				})
			},
			sc(j){
				console.log(j)
				this.footprintId = j
				console.log(this.footprintId )
				request({
					url:'xkuser/user/updatestates/'+this.userId + '/'+ this.footprintId,
					method:'get',
					success:(res)=>{
								this.load();
					}
				})
			}
		}
	}
</script>

<style>

</style>
